package com.shine.chemicalWholeProcessSystem.ui.scoreQuery;

import android.content.Context;

import com.shine.chemicalWholeProcessSystem.R;
import com.shine.chemicalWholeProcessSystem.app.ScoreQueryBean;

import java.util.List;


/**
 * Created by chawei on 2018/4/29.
 */

public class CoinAdapter extends CommonAdapter<ScoreQueryBean.RowsDTO> {

    private CommonViewHolder.onItemCommonClickListener commonClickListener;

    public CoinAdapter(Context context, List<ScoreQueryBean.RowsDTO> dataList, int layoutId, CommonViewHolder.onItemCommonClickListener listener) {
        super(context, dataList, layoutId);
        commonClickListener = listener;
    }

    public CoinAdapter(Context context, List<ScoreQueryBean.RowsDTO> dataList, int layoutId) {
        super(context, dataList, layoutId);
    }

    @Override
    public void bindData(CommonViewHolder holder, ScoreQueryBean.RowsDTO data) {
        String examState = "";
        switch (data.getExamState()) {
            case 0:
                examState = "未提交";
                break;
            case 1:
                examState = "提交";
                break;
            case 2:
                examState = "未参加";
                break;
            default:
                break;
        }

        holder.setText(R.id.studentName, data.getStudentName())
                .setText(R.id.admissionTicketId, data.getAdmissionTicketId())
                .setText(R.id.testPaperName, data.getTestPaperName())
                .setText(R.id.examState, examState)
                .setText(R.id.testPaperTotleScore, data.getTestPaperTotleScore() + "")
                .setText(R.id.theoryTotleScore, data.getTheoryTotleScore() + "")
                .setText(R.id.theoryScore, data.getTheoryScore() + "")
                .setText(R.id.operateTotleScore, data.getOperateTotleScore() + "")
                .setText(R.id.operateScore, data.getOperateScore() + "")
                .setText(R.id.studentScore, data.getStudentScore() + "")
                .setText(R.id.examStartTime, data.getExamStartTime())
                .setText(R.id.examEndTime, data.getExamEndTime())
                .setText(R.id.ret, data.getRet())
                .setCommonClickListener(commonClickListener);
    }
}
